package cn.csg.iotplatform.module.system.dal.mysql.metadata;

import java.util.*;

import cn.csg.iotplatform.framework.common.pojo.PageResult;
import cn.csg.iotplatform.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.csg.iotplatform.framework.mybatis.core.mapper.BaseMapperX;
import cn.csg.iotplatform.module.system.dal.dataobject.metadata.MetaDataDO;
import org.apache.ibatis.annotations.Mapper;
import cn.csg.iotplatform.module.system.controller.admin.metadata.vo.*;

/**
 * 前端元数据存储 Mapper
 *
 * @author cping
 */
@Mapper
public interface MetaDataMapper extends BaseMapperX<MetaDataDO> {

    default PageResult<MetaDataDO> selectPage(MetaDataPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MetaDataDO>()
                .eqIfPresent(MetaDataDO::getType, reqVO.getType())
                .eqIfPresent(MetaDataDO::getUserId, reqVO.getUserId())
                .eqIfPresent(MetaDataDO::getMetadata, reqVO.getMetadata())
                .orderByDesc(MetaDataDO::getId));
    }

}